<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" onclick="delCookie()" value="清除cookie"/>
</body>
<script>
    document.cookie = "user=name";
    alert(document.cookie);
    function delCookie() {
        var oDate=new Date();
        oDate.setDate(oDate.getDate()-14);
        document.cookie='user=blue;expires='+oDate;
        alert("delCookie"+document.cookie);
    }
</script>
</html>